home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / ADA / GCCMAIN / !gcc / gcc / h / varargs < prev   
Text File  |  1996-06-20  |  5KB  |  194 lines

  1. /* Record that this is varargs.h; this turns off stdarg.h.  */
  2.  
  3. #ifndef _VARARGS_H
  4. #define _VARARGS_H
  5.  
  6. #ifdef __sparc__
  7. #include <va-sparc.h>
  8. #else
  9. #ifdef __spur__
  10. #include <va-spur.h>
  11. #else
  12. #ifdef __mips__
  13. #include <va-mips.h>
  14. #else
  15. #ifdef __i860__
  16. #include <va-i860.h>
  17. #else
  18. #ifdef __pyr__
  19. #include <va-pyr.h>
  20. #else
  21. #ifdef __clipper__
  22. #include <va-clipper.h>
  23. #else
  24. #ifdef __m88k__
  25. #include <va-m88k.h>
  26. #else
  27. #if defined(__hppa__) || defined(hp800)
  28. #include <va-pa.h>
  29. #else
  30. #ifdef __i960__
  31. #include <va-i960.h>
  32. #else
  33. #ifdef __alpha__
  34. #include <va-alpha.h>
  35. #else
  36. #if defined (__H8300__) || defined (__H8300H__)
  37. #include <va-h8300.h>
  38. #else
  39. #if defined (__PPC__) && defined (_CALL_SYSV)
  40. #include <va-ppc.h>
  41. #else
  42. /* #if defined (__arm__)
  43. #include <va-arm.h>
  44. #else */
  45.  
  46. #ifdef __NeXT__
  47.  
  48. /* On Next, erase any vestiges of stdarg.h.  */
  49.  
  50. #ifdef _ANSI_STDARG_H_
  51. #define _VA_LIST_
  52. #endif
  53. #define _ANSI_STDARG_H_
  54.  
  55. #undef va_alist
  56. #undef va_dcl
  57. #undef va_list
  58. #undef va_start
  59. #undef va_end
  60. #undef __va_rounded_size
  61. #undef va_arg
  62. #endif  /* __NeXT__ */
  63.  
  64. /* In GCC version 2, we want an ellipsis at the end of the declaration
  65.    of the argument list.  GCC version 1 can't parse it.  */
  66.  
  67. #if __GNUC__ > 1
  68. #define __va_ellipsis ...
  69. #else
  70. #define __va_ellipsis
  71. #endif
  72.  
  73. /* These macros implement traditional (non-ANSI) varargs
  74.    for GNU C.  */
  75.  
  76. #define va_alist  __builtin_va_alist
  77. /* The ... causes current_function_varargs to be set in cc1.  */
  78. #define va_dcl    int __builtin_va_alist; __va_ellipsis
  79.  
  80. /* Define __gnuc_va_list, just as in gstdarg.h.  */
  81.  
  82. #ifndef __GNUC_VA_LIST
  83. #define __GNUC_VA_LIST
  84. #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__riscos__)
  85. typedef char *__gnuc_va_list;
  86. #else
  87. typedef void *__gnuc_va_list;
  88. #endif
  89. #endif
  90.  
  91. #define va_start(AP)  AP=(char *) &__builtin_va_alist
  92.  
  93. #define va_end(AP)    ((void)0)
  94.  
  95. #if defined(sysV68)
  96. #define __va_rounded_size(TYPE)  \
  97.   (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
  98. #else
  99. #define __va_rounded_size(TYPE)  \
  100.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  101. #endif
  102.  
  103. #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
  104. /* This is for little-endian machines; small args are padded upward.  */
  105. #define va_arg(AP, TYPE)                        \
  106.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),    \
  107.   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
  108. #else /* big-endian */
  109. /* This is for big-endian machines; small args are padded downward.  */
  110. #define va_arg(AP, TYPE)                        \
  111.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),    \
  112.   *((TYPE *) (void *) ((char *) (AP)                    \
  113.                - ((sizeof (TYPE) < __va_rounded_size (char)    \
  114.                ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
  115. #endif /* big-endian */
  116.  
  117. #endif /* not powerpc with V.4 calling sequence */
  118. #endif /* not h8300 */
  119. #endif /* not alpha */
  120. #endif /* not i960 */
  121. #endif /* not hppa */
  122. #endif /* not m88k */
  123. #endif /* not clipper */
  124. #endif /* not pyr */
  125. #endif /* not i860 */
  126. #endif /* not mips */
  127. #endif /* not spur */
  128. #endif /* not sparc */
  129. #endif /* not _VARARGS_H */
  130.  
  131. /* Define va_list from __gnuc_va_list.  */
  132.  
  133. #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
  134. #undef _VA_LIST
  135. #endif
  136.  
  137. #ifdef __svr4__
  138. /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
  139.    so we must avoid testing it and setting it here.
  140.    SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
  141.    have no conflict with that.  */
  142. #ifndef _VA_LIST_
  143. #define _VA_LIST_
  144. #ifdef __i860__
  145. #ifndef _VA_LIST
  146. #define _VA_LIST va_list
  147. #endif
  148. #endif /* __i860__ */
  149. typedef __gnuc_va_list va_list;
  150. #endif /* _VA_LIST_ */
  151.  
  152. #else /* not __svr4__ */
  153.  
  154. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  155.    But on BSD NET2 we must not test or define or undef it.
  156.    (Note that the comments in NET 2's ansi.h
  157.    are incorrect for _VA_LIST_--see stdio.h!)  */
  158. /* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993:
  159.    Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
  160.    use for va_list (``typedef _VA_LIST_ va_list'') */
  161. #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
  162. /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
  163. #ifndef _VA_LIST_DEFINED
  164. /* The macro _VA_LIST is used in SCO Unix 3.2.  */
  165. #ifndef _VA_LIST
  166. /* The macro _VA_LIST_T_H is used in the Bull dpx2  */
  167. #ifndef _VA_LIST_T_H
  168. typedef __gnuc_va_list va_list;
  169. #endif /* not _VA_LIST_T_H */
  170. #endif /* not _VA_LIST */
  171. #endif /* not _VA_LIST_DEFINED */
  172. #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
  173. #define _VA_LIST_
  174. #endif
  175. #ifndef _VA_LIST
  176. #define _VA_LIST
  177. #endif
  178. #ifndef _VA_LIST_DEFINED
  179. #define _VA_LIST_DEFINED
  180. #endif
  181. #ifndef _VA_LIST_T_H
  182. #define _VA_LIST_T_H
  183. #endif
  184.  
  185. #endif /* not _VA_LIST_, except on certain systems */
  186.  
  187. #endif /* not __svr4__ */
  188.  
  189. /* The next BSD release (if there is one) wants this symbol to be
  190.    undefined instead of _VA_LIST_.  */
  191. #ifdef _BSD_VA_LIST
  192. #undef _BSD_VA_LIST
  193. #endif
  194.